package com.weidey.blogWeb.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface WebLIkeMapper {
    void updateLike( @Param("userId") Long userId,
                     @Param("targetType") Integer targetType,
                     @Param("targetId") Long targetId,
                     @Param("status") int status);

    Integer selectLike(@Param("userId") Long userId,
                       @Param("targetType") Integer targetType,
                       @Param("targetId") Long targetId);

    Integer selectLikeCount( @Param("targetType") Integer targetType,
                             @Param("targetId") Long targetId);

    int updateLikeStatus(
            @Param("userId") Long userId,
            @Param("targetType") Integer targetType,
            @Param("targetId") Long targetId,
            @Param("status") Integer status
    );

    int insertLike(
            @Param("userId") Long userId,
            @Param("targetType") Integer targetType,
            @Param("targetId") Long targetId,
            @Param("status") Integer status
    );

    int updateCount(
            @Param("targetType") Integer targetType,
            @Param("targetId") Long targetId,
            @Param("delta") Integer delta,
            @Param("countType") String countType
    );

    List<Long> selectLikedTargetIds( @Param("userId") Long userId,
                                     @Param("targetType") Integer targetType,
                                     @Param("status") Integer status);
}
